@echo off

setlocal enabledelayedexpansion

call ..\setEnv.bat

set info_m=
set /a ret=0

echo upload upgraded initial DB new version to %upload_location% begining ... ...

if not exist %upload_location% (
  echo [ERROR]!vers! upload_location:[%upload_location%] has not exist, please check again.
  goto err_1
)

FOR /F "eol=# skip=1" %%i in (..\version_list.txt) do (
set  vers=%%i
)

if not exist ..\exp_dump_file\INIT_DB_BACKUP_TEMP\!vers! (
  echo [ERROR]!vers! dump file has not exist, please check again.
  goto err_1
) else (
  if not exist %upload_location%\!vers! mkdir %upload_location%\!vers!
  xcopy ..\exp_dump_file\INIT_DB_BACKUP_TEMP\!vers! %upload_location%\!vers! /E /Y >nul
)

:succ_1
echo upload !vers! completed ... ...
set info_m=without errors.
set /a ret=100
goto finish

:err_1
echo upload !vers! error occurred.
set info_m=with errors.
set /a ret=-100

:finish
echo finish !info_m!

exit !ret!

endlocal